<?php
require('../config.php');
		$start=0;
		$num=10;
		if(isset($_REQUEST['start'])) $start=$_REQUEST['start'];
		if(isset($_REQUEST['num'])) $num=$_REQUEST['num'];
		$sql="select s.id,s.sid,s.shop_id,s.title,s.qishu,s.thumb,s.zongrenshu,s.canyurenshu,s.shenyurenshu,s.yunjiage from `".$oto."_shoplist` as s where renqi='1' and pos='1' and shenyurenshu>0 order by shenyurenshu DESC limit $start,$num";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$jjjx_list[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($jjjx_list))
		{
			for($i=0;$i<count($jjjx_list);$i++)
			{
				$jjjx_list[$i]['percentage']=($jjjx_list[$i]['canyurenshu'] / $jjjx_list[$i]['zongrenshu']);
				$sid=$jjjx_list[$i]['sid'];
				//获取期数
				$sql="select s.qishu from `".$oto."_shoplist` as s where sid='{$sid}' order by qishu desc limit 1";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$qishu_info=$row;
				}
				if(isset($qishu_info)) $jjjx_list[$i]['max_qishu']=$qishu_info['qishu'];
				else $jjjx_list[$i]['max_qishu']="";
			}
			echo json_encode($jjjx_list);
		}
		else 
		{
			echo '[]';
		}
?>